{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "class Json_class(dict):\n",
    "    def  __init__(self, name):\n",
    "        self.update({\"name\":name})\n",
    "        return None                                ####初始化，只能返回None\n",
    "    def add_children(self,children):\n",
    "        \n",
    "            self.update({\"children\":children})\n",
    "            return self\n",
    "    def graph_viz(self,g):\n",
    "        g.node(self['name'])\n",
    "        try:\n",
    "            self['children']\n",
    "            if type(self['children'])==list:\n",
    "                [g.edge(self['name'],x['name']) for x in self['children'] ]\n",
    "                return [x.graph_viz(g) for x in  self['children']]\n",
    "            else:\n",
    "                g.edge(self['name'],self['children']['name'])\n",
    "\n",
    "                return self['children'].graph_viz(g)\n",
    "        except:\n",
    "            return g\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [],
   "source": [
    "from graphviz import Digraph"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "g = Digraph('test_digraph')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "chain=[]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(4):\n",
    "    name=str(i)\n",
    "    temp = Json_class(name)\n",
    "    chain.append(temp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'name': '0'}, {'name': '1'}, {'name': '2'}, {'name': '3'}]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "g.node((chain[0])['name'])\n",
    "for i in range( len(chain)-1):\n",
    "    #print (str(i))   \n",
    "    #g.node(i['name'])\n",
    "    now = chain[i]\n",
    "    next =chain[i+1]\n",
    "    g.node(next['name'])\n",
    "    g.edge(next['name'],now['name'])\n",
    "    \n",
    "\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "g.edge((chain[0])['name'],next['name'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Generated by graphviz version 2.38.0 (20140413.2041)\r\n",
       " -->\r\n",
       "<!-- Title: test_digraph Pages: 1 -->\r\n",
       "<svg width=\"89pt\" height=\"260pt\"\r\n",
       " viewBox=\"0.00 0.00 89.00 260.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 256)\">\r\n",
       "<title>test_digraph</title>\r\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-256 85,-256 85,4 -4,4\"/>\r\n",
       "<!-- 0 -->\r\n",
       "<g id=\"node1\" class=\"node\"><title>0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"54\" cy=\"-234\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"54\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">0</text>\r\n",
       "</g>\r\n",
       "<!-- 3 -->\r\n",
       "<g id=\"node4\" class=\"node\"><title>3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"27\" cy=\"-162\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"27\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">3</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;3 -->\r\n",
       "<g id=\"edge4\" class=\"edge\"><title>0&#45;&gt;3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M47.6014,-216.411C44.4864,-208.335 40.6663,-198.431 37.1654,-189.355\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"40.4045,-188.027 33.5403,-179.956 33.8735,-190.546 40.4045,-188.027\"/>\r\n",
       "</g>\r\n",
       "<!-- 1 -->\r\n",
       "<g id=\"node2\" class=\"node\"><title>1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"54\" cy=\"-18\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"54\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;0 -->\r\n",
       "<g id=\"edge1\" class=\"edge\"><title>1&#45;&gt;0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M57.6538,-36.0925C59.6758,-46.4315 61.9808,-59.9098 63,-72 67.0322,-119.83 67.0322,-132.17 63,-180 62.2834,-188.501 60.9311,-197.688 59.4884,-205.988\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"56.0309,-205.438 57.6538,-215.908 62.9142,-206.711 56.0309,-205.438\"/>\r\n",
       "</g>\r\n",
       "<!-- 2 -->\r\n",
       "<g id=\"node3\" class=\"node\"><title>2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"27\" cy=\"-90\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"27\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;1 -->\r\n",
       "<g id=\"edge2\" class=\"edge\"><title>2&#45;&gt;1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M33.3986,-72.411C36.5136,-64.3352 40.3337,-54.4312 43.8346,-45.3547\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"47.1265,-46.5458 47.4597,-35.9562 40.5955,-44.0267 47.1265,-46.5458\"/>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;2 -->\r\n",
       "<g id=\"edge3\" class=\"edge\"><title>3&#45;&gt;2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M27,-143.697C27,-135.983 27,-126.712 27,-118.112\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"30.5001,-118.104 27,-108.104 23.5001,-118.104 30.5001,-118.104\"/>\r\n",
       "</g>\r\n",
       "</g>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<graphviz.dot.Digraph at 0x4669df0>"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in chain:\n",
    "    wall=Json_class('wall_'+str(chain.index(i)))\n",
    "    i.add_children(wall)\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "for i in chain:\n",
    "    g.node(i['children']['name'])\n",
    "    #g.edge(i['name',i['children']['name']])\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in chain:\n",
    "    #g.node(i['children']['name'])\n",
    "    g.edge(i['name'],i['children']['name'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in chain:\n",
    "    name1='wall_with_window_'+str(chain.index(i))\n",
    "    name2='window'+str(chain.index(i))\n",
    "    i['children'].add_children(name1)\n",
    "    g.node(name1)\n",
    "    i['children'].add_children(name2)\n",
    "    g.node(name2)\n",
    "    g.edge(i['children']['name'],name1)\n",
    "    g.edge(i['children']['name'],name2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in chain:\n",
    "    name1='terrace_'+str(chain.index(i))\n",
    "\n",
    "    g.node(name1)\n",
    "    i.add_children(name1)\n",
    "  \n",
    "    g.edge(i['name'],name1)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Generated by graphviz version 2.38.0 (20140413.2041)\r\n",
       " -->\r\n",
       "<!-- Title: test_digraph Pages: 1 -->\r\n",
       "<svg width=\"1046pt\" height=\"404pt\"\r\n",
       " viewBox=\"0.00 0.00 1045.94 404.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 400)\">\r\n",
       "<title>test_digraph</title>\r\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-400 1041.94,-400 1041.94,4 -4,4\"/>\r\n",
       "<!-- 0 -->\r\n",
       "<g id=\"node1\" class=\"node\"><title>0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"719.742\" cy=\"-378\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"719.742\" y=\"-374.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">0</text>\r\n",
       "</g>\r\n",
       "<!-- 3 -->\r\n",
       "<g id=\"node4\" class=\"node\"><title>3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"638.742\" cy=\"-306\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"638.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">3</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;3 -->\r\n",
       "<g id=\"edge4\" class=\"edge\"><title>0&#45;&gt;3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M703.739,-363.17C691.98,-353.008 675.806,-339.03 662.535,-327.561\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"664.567,-324.692 654.712,-320.801 659.99,-329.988 664.567,-324.692\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_0 -->\r\n",
       "<g id=\"node5\" class=\"node\"><title>wall_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"801.742\" cy=\"-306\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"801.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_0</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;wall_0 -->\r\n",
       "<g id=\"edge5\" class=\"edge\"><title>0&#45;&gt;wall_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M735.943,-363.17C747.538,-353.272 763.373,-339.754 776.603,-328.46\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"779.11,-330.922 784.443,-321.768 774.565,-325.598 779.11,-330.922\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_0 -->\r\n",
       "<g id=\"node17\" class=\"node\"><title>terrace_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"898.742\" cy=\"-306\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"898.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_0</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;terrace_0 -->\r\n",
       "<g id=\"edge17\" class=\"edge\"><title>0&#45;&gt;terrace_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M742.413,-368.134C771.477,-356.768 822.388,-336.859 858.197,-322.856\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"859.827,-325.976 867.866,-319.075 857.278,-319.457 859.827,-325.976\"/>\r\n",
       "</g>\r\n",
       "<!-- 1 -->\r\n",
       "<g id=\"node2\" class=\"node\"><title>1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"277.742\" cy=\"-162\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"277.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;0 -->\r\n",
       "<g id=\"edge1\" class=\"edge\"><title>1&#45;&gt;0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M293.488,-176.859C315.568,-195.765 357.546,-229.82 397.742,-252 497.008,-306.774 625.279,-348.822 685.571,-367.065\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"684.749,-370.473 695.333,-369.991 686.759,-363.768 684.749,-370.473\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_1 -->\r\n",
       "<g id=\"node6\" class=\"node\"><title>wall_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"162.742\" cy=\"-90\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"162.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;wall_1 -->\r\n",
       "<g id=\"edge6\" class=\"edge\"><title>1&#45;&gt;wall_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M258.494,-149.284C240.67,-138.434 213.873,-122.123 193.156,-109.513\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"194.768,-106.397 184.407,-104.187 191.129,-112.376 194.768,-106.397\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_1 -->\r\n",
       "<g id=\"node18\" class=\"node\"><title>terrace_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"259.742\" cy=\"-90\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"259.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;terrace_1 -->\r\n",
       "<g id=\"edge18\" class=\"edge\"><title>1&#45;&gt;terrace_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M273.385,-144.055C271.381,-136.261 268.954,-126.822 266.705,-118.079\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"270.065,-117.089 264.184,-108.275 263.285,-118.832 270.065,-117.089\"/>\r\n",
       "</g>\r\n",
       "<!-- 2 -->\r\n",
       "<g id=\"node3\" class=\"node\"><title>2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"433.742\" cy=\"-234\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"433.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;1 -->\r\n",
       "<g id=\"edge2\" class=\"edge\"><title>2&#45;&gt;1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M412.051,-223.267C385.233,-211.233 339.399,-190.666 308.841,-176.955\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"310.057,-173.664 299.5,-172.763 307.191,-180.05 310.057,-173.664\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_2 -->\r\n",
       "<g id=\"node7\" class=\"node\"><title>wall_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"391.742\" cy=\"-162\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"391.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;wall_2 -->\r\n",
       "<g id=\"edge7\" class=\"edge\"><title>2&#45;&gt;wall_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M424.212,-217.116C419.076,-208.557 412.621,-197.797 406.821,-188.132\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"409.673,-186.081 401.526,-179.307 403.67,-189.683 409.673,-186.081\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_2 -->\r\n",
       "<g id=\"node19\" class=\"node\"><title>terrace_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"488.742\" cy=\"-162\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"488.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;terrace_2 -->\r\n",
       "<g id=\"edge19\" class=\"edge\"><title>2&#45;&gt;terrace_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M445.676,-217.811C452.588,-209.015 461.454,-197.73 469.344,-187.688\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"472.251,-189.653 475.677,-179.628 466.747,-185.329 472.251,-189.653\"/>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;2 -->\r\n",
       "<g id=\"edge3\" class=\"edge\"><title>3&#45;&gt;2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M615.226,-296.97C578.792,-284.529 508.574,-260.552 466.971,-246.346\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"467.893,-242.963 457.299,-243.044 465.631,-249.587 467.893,-242.963\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_3 -->\r\n",
       "<g id=\"node8\" class=\"node\"><title>wall_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"596.742\" cy=\"-234\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"596.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_3</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;wall_3 -->\r\n",
       "<g id=\"edge8\" class=\"edge\"><title>3&#45;&gt;wall_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M629.212,-289.116C624.076,-280.557 617.621,-269.797 611.821,-260.132\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"614.673,-258.081 606.526,-251.307 608.67,-261.683 614.673,-258.081\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_3 -->\r\n",
       "<g id=\"node20\" class=\"node\"><title>terrace_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"693.742\" cy=\"-234\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"693.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_3</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;terrace_3 -->\r\n",
       "<g id=\"edge20\" class=\"edge\"><title>3&#45;&gt;terrace_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M650.676,-289.811C657.588,-281.015 666.454,-269.73 674.344,-259.688\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"677.251,-261.653 680.677,-251.628 671.747,-257.329 677.251,-261.653\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_0 -->\r\n",
       "<g id=\"node9\" class=\"node\"><title>wall_with_window_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"843.742\" cy=\"-234\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"843.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_0</text>\r\n",
       "</g>\r\n",
       "<!-- wall_0&#45;&gt;wall_with_window_0 -->\r\n",
       "<g id=\"edge9\" class=\"edge\"><title>wall_0&#45;&gt;wall_with_window_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M811.696,-288.411C816.644,-280.163 822.737,-270.009 828.276,-260.777\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"831.425,-262.332 833.568,-251.956 825.422,-258.73 831.425,-262.332\"/>\r\n",
       "</g>\r\n",
       "<!-- window0 -->\r\n",
       "<g id=\"node10\" class=\"node\"><title>window0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"993.742\" cy=\"-234\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"993.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window0</text>\r\n",
       "</g>\r\n",
       "<!-- wall_0&#45;&gt;window0 -->\r\n",
       "<g id=\"edge10\" class=\"edge\"><title>wall_0&#45;&gt;window0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M828.694,-294.465C834.318,-292.301 840.216,-290.057 845.742,-288 881.362,-274.743 922.024,-260.226 951.702,-249.742\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"953.056,-252.976 961.322,-246.349 950.728,-246.375 953.056,-252.976\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_1 -->\r\n",
       "<g id=\"node11\" class=\"node\"><title>wall_with_window_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"87.7422\" cy=\"-18\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"87.7422\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_1</text>\r\n",
       "</g>\r\n",
       "<!-- wall_1&#45;&gt;wall_with_window_1 -->\r\n",
       "<g id=\"edge11\" class=\"edge\"><title>wall_1&#45;&gt;wall_with_window_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M146.468,-73.811C136.667,-64.6632 123.981,-52.8233 112.91,-42.4896\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"115.256,-39.8924 105.558,-35.6278 110.48,-45.0098 115.256,-39.8924\"/>\r\n",
       "</g>\r\n",
       "<!-- window1 -->\r\n",
       "<g id=\"node12\" class=\"node\"><title>window1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"237.742\" cy=\"-18\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"237.742\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window1</text>\r\n",
       "</g>\r\n",
       "<!-- wall_1&#45;&gt;window1 -->\r\n",
       "<g id=\"edge12\" class=\"edge\"><title>wall_1&#45;&gt;window1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M179.016,-73.811C189.027,-64.4672 202.048,-52.3146 213.284,-41.8274\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"215.797,-44.2701 220.719,-34.8882 211.02,-39.1527 215.797,-44.2701\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_2 -->\r\n",
       "<g id=\"node13\" class=\"node\"><title>wall_with_window_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"409.742\" cy=\"-90\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"409.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_2</text>\r\n",
       "</g>\r\n",
       "<!-- wall_2&#45;&gt;wall_with_window_2 -->\r\n",
       "<g id=\"edge13\" class=\"edge\"><title>wall_2&#45;&gt;wall_with_window_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M396.1,-144.055C398.104,-136.261 400.531,-126.822 402.779,-118.079\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"406.199,-118.832 405.3,-108.275 399.42,-117.089 406.199,-118.832\"/>\r\n",
       "</g>\r\n",
       "<!-- window2 -->\r\n",
       "<g id=\"node14\" class=\"node\"><title>window2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"559.742\" cy=\"-90\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"559.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window2</text>\r\n",
       "</g>\r\n",
       "<!-- wall_2&#45;&gt;window2 -->\r\n",
       "<g id=\"edge14\" class=\"edge\"><title>wall_2&#45;&gt;window2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M417.992,-150.063C445.508,-138.598 489.046,-120.457 520.615,-107.303\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"522.113,-110.471 529.997,-103.394 519.42,-104.009 522.113,-110.471\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_3 -->\r\n",
       "<g id=\"node15\" class=\"node\"><title>wall_with_window_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"638.742\" cy=\"-162\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"638.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_3</text>\r\n",
       "</g>\r\n",
       "<!-- wall_3&#45;&gt;wall_with_window_3 -->\r\n",
       "<g id=\"edge15\" class=\"edge\"><title>wall_3&#45;&gt;wall_with_window_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M606.696,-216.411C611.644,-208.163 617.737,-198.009 623.276,-188.777\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"626.425,-190.332 628.568,-179.956 620.422,-186.73 626.425,-190.332\"/>\r\n",
       "</g>\r\n",
       "<!-- window3 -->\r\n",
       "<g id=\"node16\" class=\"node\"><title>window3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"788.742\" cy=\"-162\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"788.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window3</text>\r\n",
       "</g>\r\n",
       "<!-- wall_3&#45;&gt;window3 -->\r\n",
       "<g id=\"edge16\" class=\"edge\"><title>wall_3&#45;&gt;window3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M623.694,-222.465C629.318,-220.301 635.216,-218.057 640.742,-216 676.362,-202.743 717.024,-188.226 746.702,-177.742\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"748.056,-180.976 756.322,-174.349 745.728,-174.375 748.056,-180.976\"/>\r\n",
       "</g>\r\n",
       "</g>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<graphviz.dot.Digraph at 0x4669df0>"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "g"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Generated by graphviz version 2.38.0 (20140413.2041)\r\n",
       " -->\r\n",
       "<!-- Title: test_digraph Pages: 1 -->\r\n",
       "<svg width=\"1046pt\" height=\"404pt\"\r\n",
       " viewBox=\"0.00 0.00 1045.94 404.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 400)\">\r\n",
       "<title>test_digraph</title>\r\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-400 1041.94,-400 1041.94,4 -4,4\"/>\r\n",
       "<!-- 0 -->\r\n",
       "<g id=\"node1\" class=\"node\"><title>0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"719.742\" cy=\"-378\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"719.742\" y=\"-374.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">0</text>\r\n",
       "</g>\r\n",
       "<!-- 3 -->\r\n",
       "<g id=\"node4\" class=\"node\"><title>3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"638.742\" cy=\"-306\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"638.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">3</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;3 -->\r\n",
       "<g id=\"edge4\" class=\"edge\"><title>0&#45;&gt;3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M703.739,-363.17C691.98,-353.008 675.806,-339.03 662.535,-327.561\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"664.567,-324.692 654.712,-320.801 659.99,-329.988 664.567,-324.692\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_0 -->\r\n",
       "<g id=\"node5\" class=\"node\"><title>wall_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"801.742\" cy=\"-306\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"801.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_0</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;wall_0 -->\r\n",
       "<g id=\"edge5\" class=\"edge\"><title>0&#45;&gt;wall_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M735.943,-363.17C747.538,-353.272 763.373,-339.754 776.603,-328.46\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"779.11,-330.922 784.443,-321.768 774.565,-325.598 779.11,-330.922\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_0 -->\r\n",
       "<g id=\"node17\" class=\"node\"><title>terrace_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"898.742\" cy=\"-306\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"898.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_0</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;terrace_0 -->\r\n",
       "<g id=\"edge17\" class=\"edge\"><title>0&#45;&gt;terrace_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M742.413,-368.134C771.477,-356.768 822.388,-336.859 858.197,-322.856\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"859.827,-325.976 867.866,-319.075 857.278,-319.457 859.827,-325.976\"/>\r\n",
       "</g>\r\n",
       "<!-- 1 -->\r\n",
       "<g id=\"node2\" class=\"node\"><title>1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"277.742\" cy=\"-162\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"277.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;0 -->\r\n",
       "<g id=\"edge1\" class=\"edge\"><title>1&#45;&gt;0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M293.488,-176.859C315.568,-195.765 357.546,-229.82 397.742,-252 497.008,-306.774 625.279,-348.822 685.571,-367.065\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"684.749,-370.473 695.333,-369.991 686.759,-363.768 684.749,-370.473\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_1 -->\r\n",
       "<g id=\"node6\" class=\"node\"><title>wall_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"162.742\" cy=\"-90\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"162.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;wall_1 -->\r\n",
       "<g id=\"edge6\" class=\"edge\"><title>1&#45;&gt;wall_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M258.494,-149.284C240.67,-138.434 213.873,-122.123 193.156,-109.513\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"194.768,-106.397 184.407,-104.187 191.129,-112.376 194.768,-106.397\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_1 -->\r\n",
       "<g id=\"node18\" class=\"node\"><title>terrace_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"259.742\" cy=\"-90\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"259.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;terrace_1 -->\r\n",
       "<g id=\"edge18\" class=\"edge\"><title>1&#45;&gt;terrace_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M273.385,-144.055C271.381,-136.261 268.954,-126.822 266.705,-118.079\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"270.065,-117.089 264.184,-108.275 263.285,-118.832 270.065,-117.089\"/>\r\n",
       "</g>\r\n",
       "<!-- 2 -->\r\n",
       "<g id=\"node3\" class=\"node\"><title>2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"433.742\" cy=\"-234\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"433.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;1 -->\r\n",
       "<g id=\"edge2\" class=\"edge\"><title>2&#45;&gt;1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M412.051,-223.267C385.233,-211.233 339.399,-190.666 308.841,-176.955\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"310.057,-173.664 299.5,-172.763 307.191,-180.05 310.057,-173.664\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_2 -->\r\n",
       "<g id=\"node7\" class=\"node\"><title>wall_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"391.742\" cy=\"-162\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"391.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;wall_2 -->\r\n",
       "<g id=\"edge7\" class=\"edge\"><title>2&#45;&gt;wall_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M424.212,-217.116C419.076,-208.557 412.621,-197.797 406.821,-188.132\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"409.673,-186.081 401.526,-179.307 403.67,-189.683 409.673,-186.081\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_2 -->\r\n",
       "<g id=\"node19\" class=\"node\"><title>terrace_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"488.742\" cy=\"-162\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"488.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;terrace_2 -->\r\n",
       "<g id=\"edge19\" class=\"edge\"><title>2&#45;&gt;terrace_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M445.676,-217.811C452.588,-209.015 461.454,-197.73 469.344,-187.688\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"472.251,-189.653 475.677,-179.628 466.747,-185.329 472.251,-189.653\"/>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;2 -->\r\n",
       "<g id=\"edge3\" class=\"edge\"><title>3&#45;&gt;2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M615.226,-296.97C578.792,-284.529 508.574,-260.552 466.971,-246.346\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"467.893,-242.963 457.299,-243.044 465.631,-249.587 467.893,-242.963\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_3 -->\r\n",
       "<g id=\"node8\" class=\"node\"><title>wall_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"596.742\" cy=\"-234\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"596.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_3</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;wall_3 -->\r\n",
       "<g id=\"edge8\" class=\"edge\"><title>3&#45;&gt;wall_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M629.212,-289.116C624.076,-280.557 617.621,-269.797 611.821,-260.132\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"614.673,-258.081 606.526,-251.307 608.67,-261.683 614.673,-258.081\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_3 -->\r\n",
       "<g id=\"node20\" class=\"node\"><title>terrace_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"693.742\" cy=\"-234\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"693.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_3</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;terrace_3 -->\r\n",
       "<g id=\"edge20\" class=\"edge\"><title>3&#45;&gt;terrace_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M650.676,-289.811C657.588,-281.015 666.454,-269.73 674.344,-259.688\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"677.251,-261.653 680.677,-251.628 671.747,-257.329 677.251,-261.653\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_0 -->\r\n",
       "<g id=\"node9\" class=\"node\"><title>wall_with_window_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"843.742\" cy=\"-234\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"843.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_0</text>\r\n",
       "</g>\r\n",
       "<!-- wall_0&#45;&gt;wall_with_window_0 -->\r\n",
       "<g id=\"edge9\" class=\"edge\"><title>wall_0&#45;&gt;wall_with_window_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M811.696,-288.411C816.644,-280.163 822.737,-270.009 828.276,-260.777\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"831.425,-262.332 833.568,-251.956 825.422,-258.73 831.425,-262.332\"/>\r\n",
       "</g>\r\n",
       "<!-- window0 -->\r\n",
       "<g id=\"node10\" class=\"node\"><title>window0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"993.742\" cy=\"-234\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"993.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window0</text>\r\n",
       "</g>\r\n",
       "<!-- wall_0&#45;&gt;window0 -->\r\n",
       "<g id=\"edge10\" class=\"edge\"><title>wall_0&#45;&gt;window0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M828.694,-294.465C834.318,-292.301 840.216,-290.057 845.742,-288 881.362,-274.743 922.024,-260.226 951.702,-249.742\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"953.056,-252.976 961.322,-246.349 950.728,-246.375 953.056,-252.976\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_1 -->\r\n",
       "<g id=\"node11\" class=\"node\"><title>wall_with_window_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"87.7422\" cy=\"-18\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"87.7422\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_1</text>\r\n",
       "</g>\r\n",
       "<!-- wall_1&#45;&gt;wall_with_window_1 -->\r\n",
       "<g id=\"edge11\" class=\"edge\"><title>wall_1&#45;&gt;wall_with_window_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M146.468,-73.811C136.667,-64.6632 123.981,-52.8233 112.91,-42.4896\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"115.256,-39.8924 105.558,-35.6278 110.48,-45.0098 115.256,-39.8924\"/>\r\n",
       "</g>\r\n",
       "<!-- window1 -->\r\n",
       "<g id=\"node12\" class=\"node\"><title>window1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"237.742\" cy=\"-18\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"237.742\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window1</text>\r\n",
       "</g>\r\n",
       "<!-- wall_1&#45;&gt;window1 -->\r\n",
       "<g id=\"edge12\" class=\"edge\"><title>wall_1&#45;&gt;window1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M179.016,-73.811C189.027,-64.4672 202.048,-52.3146 213.284,-41.8274\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"215.797,-44.2701 220.719,-34.8882 211.02,-39.1527 215.797,-44.2701\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_2 -->\r\n",
       "<g id=\"node13\" class=\"node\"><title>wall_with_window_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"409.742\" cy=\"-90\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"409.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_2</text>\r\n",
       "</g>\r\n",
       "<!-- wall_2&#45;&gt;wall_with_window_2 -->\r\n",
       "<g id=\"edge13\" class=\"edge\"><title>wall_2&#45;&gt;wall_with_window_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M396.1,-144.055C398.104,-136.261 400.531,-126.822 402.779,-118.079\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"406.199,-118.832 405.3,-108.275 399.42,-117.089 406.199,-118.832\"/>\r\n",
       "</g>\r\n",
       "<!-- window2 -->\r\n",
       "<g id=\"node14\" class=\"node\"><title>window2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"559.742\" cy=\"-90\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"559.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window2</text>\r\n",
       "</g>\r\n",
       "<!-- wall_2&#45;&gt;window2 -->\r\n",
       "<g id=\"edge14\" class=\"edge\"><title>wall_2&#45;&gt;window2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M417.992,-150.063C445.508,-138.598 489.046,-120.457 520.615,-107.303\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"522.113,-110.471 529.997,-103.394 519.42,-104.009 522.113,-110.471\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_3 -->\r\n",
       "<g id=\"node15\" class=\"node\"><title>wall_with_window_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"638.742\" cy=\"-162\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"638.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_3</text>\r\n",
       "</g>\r\n",
       "<!-- wall_3&#45;&gt;wall_with_window_3 -->\r\n",
       "<g id=\"edge15\" class=\"edge\"><title>wall_3&#45;&gt;wall_with_window_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M606.696,-216.411C611.644,-208.163 617.737,-198.009 623.276,-188.777\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"626.425,-190.332 628.568,-179.956 620.422,-186.73 626.425,-190.332\"/>\r\n",
       "</g>\r\n",
       "<!-- window3 -->\r\n",
       "<g id=\"node16\" class=\"node\"><title>window3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"788.742\" cy=\"-162\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"788.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window3</text>\r\n",
       "</g>\r\n",
       "<!-- wall_3&#45;&gt;window3 -->\r\n",
       "<g id=\"edge16\" class=\"edge\"><title>wall_3&#45;&gt;window3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M623.694,-222.465C629.318,-220.301 635.216,-218.057 640.742,-216 676.362,-202.743 717.024,-188.226 746.702,-177.742\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"748.056,-180.976 756.322,-174.349 745.728,-174.375 748.056,-180.976\"/>\r\n",
       "</g>\r\n",
       "</g>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<graphviz.dot.Digraph at 0x4669df0>"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chain[1]."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "blank=Json_class('blank')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'name': '0', 'children': {'name': 'blank'}}"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chain[0].add_children(blank)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\r\n",
       "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n",
       " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n",
       "<!-- Generated by graphviz version 2.38.0 (20140413.2041)\r\n",
       " -->\r\n",
       "<!-- Title: test_digraph Pages: 1 -->\r\n",
       "<svg width=\"1046pt\" height=\"404pt\"\r\n",
       " viewBox=\"0.00 0.00 1045.94 404.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 400)\">\r\n",
       "<title>test_digraph</title>\r\n",
       "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-400 1041.94,-400 1041.94,4 -4,4\"/>\r\n",
       "<!-- 0 -->\r\n",
       "<g id=\"node1\" class=\"node\"><title>0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"801.742\" cy=\"-378\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"801.742\" y=\"-374.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">0</text>\r\n",
       "</g>\r\n",
       "<!-- 3 -->\r\n",
       "<g id=\"node4\" class=\"node\"><title>3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"638.742\" cy=\"-306\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"638.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">3</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;3 -->\r\n",
       "<g id=\"edge4\" class=\"edge\"><title>0&#45;&gt;3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M779.42,-367.414C751.132,-355.265 702.207,-334.255 670.158,-320.492\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"671.365,-317.201 660.795,-316.471 668.603,-323.633 671.365,-317.201\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_0 -->\r\n",
       "<g id=\"node5\" class=\"node\"><title>wall_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"801.742\" cy=\"-306\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"801.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_0</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;wall_0 -->\r\n",
       "<g id=\"edge5\" class=\"edge\"><title>0&#45;&gt;wall_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M801.742,-359.697C801.742,-351.983 801.742,-342.712 801.742,-334.112\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"805.242,-334.104 801.742,-324.104 798.242,-334.104 805.242,-334.104\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_0 -->\r\n",
       "<g id=\"node17\" class=\"node\"><title>terrace_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"898.742\" cy=\"-306\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"898.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_0</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;terrace_0 -->\r\n",
       "<g id=\"edge17\" class=\"edge\"><title>0&#45;&gt;terrace_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M819.534,-364.161C833.599,-354.01 853.519,-339.636 869.863,-327.841\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"871.973,-330.634 878.034,-321.944 867.877,-324.958 871.973,-330.634\"/>\r\n",
       "</g>\r\n",
       "<!-- blank -->\r\n",
       "<g id=\"node21\" class=\"node\"><title>blank</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"991.742\" cy=\"-306\" rx=\"30.5947\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"991.742\" y=\"-302.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">blank</text>\r\n",
       "</g>\r\n",
       "<!-- 0&#45;&gt;blank -->\r\n",
       "<g id=\"edge21\" class=\"edge\"><title>0&#45;&gt;blank</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M825.292,-369.185C854.973,-359.221 907.465,-341.212 951.742,-324 953.938,-323.147 956.193,-322.248 958.46,-321.329\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"959.827,-324.551 967.728,-317.492 957.15,-318.083 959.827,-324.551\"/>\r\n",
       "</g>\r\n",
       "<!-- 1 -->\r\n",
       "<g id=\"node2\" class=\"node\"><title>1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"277.742\" cy=\"-162\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"277.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;0 -->\r\n",
       "<g id=\"edge1\" class=\"edge\"><title>1&#45;&gt;0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M293.387,-177.046C315.349,-196.17 357.19,-230.476 397.742,-252 524.455,-319.254 693.089,-356.663 765.837,-370.607\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"765.383,-374.083 775.858,-372.495 766.679,-367.204 765.383,-374.083\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_1 -->\r\n",
       "<g id=\"node6\" class=\"node\"><title>wall_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"162.742\" cy=\"-90\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"162.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;wall_1 -->\r\n",
       "<g id=\"edge6\" class=\"edge\"><title>1&#45;&gt;wall_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M258.494,-149.284C240.67,-138.434 213.873,-122.123 193.156,-109.513\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"194.768,-106.397 184.407,-104.187 191.129,-112.376 194.768,-106.397\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_1 -->\r\n",
       "<g id=\"node18\" class=\"node\"><title>terrace_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"259.742\" cy=\"-90\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"259.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_1</text>\r\n",
       "</g>\r\n",
       "<!-- 1&#45;&gt;terrace_1 -->\r\n",
       "<g id=\"edge18\" class=\"edge\"><title>1&#45;&gt;terrace_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M273.385,-144.055C271.381,-136.261 268.954,-126.822 266.705,-118.079\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"270.065,-117.089 264.184,-108.275 263.285,-118.832 270.065,-117.089\"/>\r\n",
       "</g>\r\n",
       "<!-- 2 -->\r\n",
       "<g id=\"node3\" class=\"node\"><title>2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"433.742\" cy=\"-234\" rx=\"27\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"433.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;1 -->\r\n",
       "<g id=\"edge2\" class=\"edge\"><title>2&#45;&gt;1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M412.051,-223.267C385.233,-211.233 339.399,-190.666 308.841,-176.955\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"310.057,-173.664 299.5,-172.763 307.191,-180.05 310.057,-173.664\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_2 -->\r\n",
       "<g id=\"node7\" class=\"node\"><title>wall_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"391.742\" cy=\"-162\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"391.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;wall_2 -->\r\n",
       "<g id=\"edge7\" class=\"edge\"><title>2&#45;&gt;wall_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M424.212,-217.116C419.076,-208.557 412.621,-197.797 406.821,-188.132\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"409.673,-186.081 401.526,-179.307 403.67,-189.683 409.673,-186.081\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_2 -->\r\n",
       "<g id=\"node19\" class=\"node\"><title>terrace_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"488.742\" cy=\"-162\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"488.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_2</text>\r\n",
       "</g>\r\n",
       "<!-- 2&#45;&gt;terrace_2 -->\r\n",
       "<g id=\"edge19\" class=\"edge\"><title>2&#45;&gt;terrace_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M445.676,-217.811C452.588,-209.015 461.454,-197.73 469.344,-187.688\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"472.251,-189.653 475.677,-179.628 466.747,-185.329 472.251,-189.653\"/>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;2 -->\r\n",
       "<g id=\"edge3\" class=\"edge\"><title>3&#45;&gt;2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M615.226,-296.97C578.792,-284.529 508.574,-260.552 466.971,-246.346\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"467.893,-242.963 457.299,-243.044 465.631,-249.587 467.893,-242.963\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_3 -->\r\n",
       "<g id=\"node8\" class=\"node\"><title>wall_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"596.742\" cy=\"-234\" rx=\"34.394\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"596.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_3</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;wall_3 -->\r\n",
       "<g id=\"edge8\" class=\"edge\"><title>3&#45;&gt;wall_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M629.212,-289.116C624.076,-280.557 617.621,-269.797 611.821,-260.132\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"614.673,-258.081 606.526,-251.307 608.67,-261.683 614.673,-258.081\"/>\r\n",
       "</g>\r\n",
       "<!-- terrace_3 -->\r\n",
       "<g id=\"node20\" class=\"node\"><title>terrace_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"693.742\" cy=\"-234\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"693.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">terrace_3</text>\r\n",
       "</g>\r\n",
       "<!-- 3&#45;&gt;terrace_3 -->\r\n",
       "<g id=\"edge20\" class=\"edge\"><title>3&#45;&gt;terrace_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M650.676,-289.811C657.588,-281.015 666.454,-269.73 674.344,-259.688\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"677.251,-261.653 680.677,-251.628 671.747,-257.329 677.251,-261.653\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_0 -->\r\n",
       "<g id=\"node9\" class=\"node\"><title>wall_with_window_0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"843.742\" cy=\"-234\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"843.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_0</text>\r\n",
       "</g>\r\n",
       "<!-- wall_0&#45;&gt;wall_with_window_0 -->\r\n",
       "<g id=\"edge9\" class=\"edge\"><title>wall_0&#45;&gt;wall_with_window_0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M811.696,-288.411C816.644,-280.163 822.737,-270.009 828.276,-260.777\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"831.425,-262.332 833.568,-251.956 825.422,-258.73 831.425,-262.332\"/>\r\n",
       "</g>\r\n",
       "<!-- window0 -->\r\n",
       "<g id=\"node10\" class=\"node\"><title>window0</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"993.742\" cy=\"-234\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"993.742\" y=\"-230.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window0</text>\r\n",
       "</g>\r\n",
       "<!-- wall_0&#45;&gt;window0 -->\r\n",
       "<g id=\"edge10\" class=\"edge\"><title>wall_0&#45;&gt;window0</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M828.694,-294.465C834.318,-292.301 840.216,-290.057 845.742,-288 881.362,-274.743 922.024,-260.226 951.702,-249.742\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"953.056,-252.976 961.322,-246.349 950.728,-246.375 953.056,-252.976\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_1 -->\r\n",
       "<g id=\"node11\" class=\"node\"><title>wall_with_window_1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"87.7422\" cy=\"-18\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"87.7422\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_1</text>\r\n",
       "</g>\r\n",
       "<!-- wall_1&#45;&gt;wall_with_window_1 -->\r\n",
       "<g id=\"edge11\" class=\"edge\"><title>wall_1&#45;&gt;wall_with_window_1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M146.468,-73.811C136.667,-64.6632 123.981,-52.8233 112.91,-42.4896\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"115.256,-39.8924 105.558,-35.6278 110.48,-45.0098 115.256,-39.8924\"/>\r\n",
       "</g>\r\n",
       "<!-- window1 -->\r\n",
       "<g id=\"node12\" class=\"node\"><title>window1</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"237.742\" cy=\"-18\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"237.742\" y=\"-14.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window1</text>\r\n",
       "</g>\r\n",
       "<!-- wall_1&#45;&gt;window1 -->\r\n",
       "<g id=\"edge12\" class=\"edge\"><title>wall_1&#45;&gt;window1</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M179.016,-73.811C189.027,-64.4672 202.048,-52.3146 213.284,-41.8274\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"215.797,-44.2701 220.719,-34.8882 211.02,-39.1527 215.797,-44.2701\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_2 -->\r\n",
       "<g id=\"node13\" class=\"node\"><title>wall_with_window_2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"409.742\" cy=\"-90\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"409.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_2</text>\r\n",
       "</g>\r\n",
       "<!-- wall_2&#45;&gt;wall_with_window_2 -->\r\n",
       "<g id=\"edge13\" class=\"edge\"><title>wall_2&#45;&gt;wall_with_window_2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M396.1,-144.055C398.104,-136.261 400.531,-126.822 402.779,-118.079\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"406.199,-118.832 405.3,-108.275 399.42,-117.089 406.199,-118.832\"/>\r\n",
       "</g>\r\n",
       "<!-- window2 -->\r\n",
       "<g id=\"node14\" class=\"node\"><title>window2</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"559.742\" cy=\"-90\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"559.742\" y=\"-86.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window2</text>\r\n",
       "</g>\r\n",
       "<!-- wall_2&#45;&gt;window2 -->\r\n",
       "<g id=\"edge14\" class=\"edge\"><title>wall_2&#45;&gt;window2</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M417.992,-150.063C445.508,-138.598 489.046,-120.457 520.615,-107.303\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"522.113,-110.471 529.997,-103.394 519.42,-104.009 522.113,-110.471\"/>\r\n",
       "</g>\r\n",
       "<!-- wall_with_window_3 -->\r\n",
       "<g id=\"node15\" class=\"node\"><title>wall_with_window_3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"638.742\" cy=\"-162\" rx=\"87.9851\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"638.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">wall_with_window_3</text>\r\n",
       "</g>\r\n",
       "<!-- wall_3&#45;&gt;wall_with_window_3 -->\r\n",
       "<g id=\"edge15\" class=\"edge\"><title>wall_3&#45;&gt;wall_with_window_3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M606.696,-216.411C611.644,-208.163 617.737,-198.009 623.276,-188.777\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"626.425,-190.332 628.568,-179.956 620.422,-186.73 626.425,-190.332\"/>\r\n",
       "</g>\r\n",
       "<!-- window3 -->\r\n",
       "<g id=\"node16\" class=\"node\"><title>window3</title>\r\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"788.742\" cy=\"-162\" rx=\"44.393\" ry=\"18\"/>\r\n",
       "<text text-anchor=\"middle\" x=\"788.742\" y=\"-158.3\" font-family=\"Times New Roman,serif\" font-size=\"14.00\">window3</text>\r\n",
       "</g>\r\n",
       "<!-- wall_3&#45;&gt;window3 -->\r\n",
       "<g id=\"edge16\" class=\"edge\"><title>wall_3&#45;&gt;window3</title>\r\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M623.694,-222.465C629.318,-220.301 635.216,-218.057 640.742,-216 676.362,-202.743 717.024,-188.226 746.702,-177.742\"/>\r\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"748.056,-180.976 756.322,-174.349 745.728,-174.375 748.056,-180.976\"/>\r\n",
       "</g>\r\n",
       "</g>\r\n",
       "</svg>\r\n"
      ],
      "text/plain": [
       "<graphviz.dot.Digraph at 0x4669df0>"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "chain[0].graph_viz(g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
